<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #root{
            width:100px;
            height: 100px;
            background-color: red;
        }
    </style>
</head>
<body>
    <div id="root"></div>
    <script>
        let start;
        let root = document.getElementById("root");
        function animate(timeStart){
            if(!start){
                start = timeStart;
            }
            console.log(timeStart-start);
            root.style.transform = "translateX("+timeStart*0.01+"px)";
            if(timeStart<10000)
               window.requestAnimationFrame(animate);
        }
        window.requestAnimationFrame(animate);
    </script>
</body>
</html>